/* Copyright (C) 2024 wlly-lzh
 * Created On 24/03/12
 * Singly Linked List  单链表(封装)
 * */

#ifndef _SLLIST_H
#define _SLLIST_H

#define u_int unsigned int
#include <stdbool.h>
typedef struct LSLList LSLList;
struct LSLList {};
LSLList * Create_LSLList();
// 创建一个空链表
bool Destroy_LSLList(LSLList **List,void (*FreeData)(void *));
// 销毁
bool Clear_LSLList(LSLList *List,void (*FreeData)(void*));
// 清空
bool Insert_LSLList(LSLList *List,unsigned int addr,void *Data);
// 插入数据
bool Delete_LSLList(LSLList *List,unsigned int addr,
		void (*FreeData)(void *));
// 删除
unsigned int Length_LSLList(const LSLList * List);
// 单链表的长度
bool GetItem_LSLList(const LSLList *List,unsigned int addr,
		void **Data);
// 获取指定位置的元素
bool Update_LSLList(LSLList *List, u_int addr, void *Data,
		void (*FreeData)(void *));

bool AddHead_LSLList(LSLList *List,void *Data);
bool AddTail_LSLList(LSLList *List,void *Data);
#undef u_int

#endif // _SLLIST_H
